
/**
 * @功能描述: 基础menu样式文件
 * @author: lzn
 * @date: 2022-09-21 10:21:22
 * @version: 1.0
 */
@import '../../style/index.scss';

$menu-padding-left: 40px;

// group标题 定位相关
@mixin menu-item-group-title--layout {
  margin: 16px 0;
  padding: 8px 16px;
  padding-left: $menu-padding-left;
}

//  基础menu样式 纵向排列
@include b(base-menu) {
  overflow: auto;
  border-right: $border-base;
  font-size: $font-size-small;
  // group title样式
  .menu-item-group-title {
    @include menu-item-group-title--layout;
    color: $color-text-regular;
    &::after {
      display: block;
      position: relative;
      top: 12px;
      width: calc(100% - 20px);
      height: 1px;
      background: $border-color-base;
      content: "";
    }
  }
  // menu项样式
  .menu-item {
    position: relative;
    margin: 4px 0 8px 0;
    padding: 0 16px;
    padding-left: $menu-padding-left;
    height: 40px;
    line-height: 40px;
    &:not(:last-child) {
      margin-bottom: 8px;
    }
    &:hover {
      a, .menu-item-sub-title {
        color: $color-primary;
      }
    }
    a {
      display: block;
      height: 100%;
      @include single-ellipsis;
    }
    // 被选中样式
    &.selected {
      background-color: $color-primary-light-8;
      &::after {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        border-right: 3px solid $color-primary;
        content: "";
      }
      a, .menu-item-sub-title {
        color: $color-primary;
      }
    }
  }
  // menu 项 文字样式
  .menu-item-sub-title {
    margin-left: 6px;
    font-size: 12px;
    color: $color-text-secondary;
  }
  // 横向排列menu样式
  &.#{$namespace}-menu-overflow {
    display: flex;
    .menu-item {
      margin-top: -1px;
      margin-bottom: 0;
      padding: 0 20px;
      &.selected {
        background-color: transparent;
        &::after {
          right: 20px;
          bottom: 0;
          left: 20px;
          border-bottom: 2px solid $color-primary;
          border-right: none;
          content: "";
        }
      }
    }
  }
}